import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Father from "../components/Father.vue";

const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        name: "Father",
        component: Father,
    },
    {
        path: "/child",
        name: "Child",
        component: () => import("../components/Child.vue")
    }
];

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
});

// router.beforeEach((to, from, next) => {
//     if (to || from) {
//         console.log(to, from)
//         next()
//     } else {
//         next()
//     }
// })

// router.afterEach((to, from) => {
//     const { title } = to.meta
//     document.title = title || "VUE3"
// })


export default router;
